import numpy as np
import matplotlib.pyplot as plt


def show_line_and_data(w, data, value, is_show=True):
    w_shape = w.shape
    data_shape = data.shape
    value_shape = value.shape
    slope = np.array(w)[0][0] / np.array(w)[1][0]
    inx = np.array(w)[2][0] / np.array(w)[1][0]
    # print(slope,inx)
    prex = np.array(range(-10, 20))
    prey = -slope * prex - inx
    if is_show:
        plt.plot(prex, prey)
        plt.scatter(data[:, 0], data[:, 1], c=value)
        plt.ylim(-10, 10)
        plt.show()


def show_loss(losses):
    x = list(range(len(losses)))
    plt.plot(x, losses)
    plt.show()

